// pages/index/component/swiperBg/swiperBg.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    title: '吃莆田',
    isChoose: 0,
  },
  pageLifetimes:{
    ready(){
  
      this.triggerEvent('getCanHeight')
    },
  },
  /**
   * 组件的方法列表
   */
  ready(){
    this.setNavSize()
  },
  methods: {
    setNavSize: function () {
      var that = this,
        sysinfo = wx.getSystemInfoSync(),
        statusHeight = sysinfo.statusBarHeight,
        isiOS = sysinfo.system.indexOf('iOS') > -1,
        navHeight;
      console.log(sysinfo)
      if (!isiOS) {
        navHeight = 48;
      } else {
        navHeight = 44;
      }
      that.setData({
        status: statusHeight,
        navHeight: navHeight
      })
    },
    toIndex() {
      if (this.data.isChoose == 0) {
        wx.navigateTo({
          url: '/pages/restaurant/index'
        })
      } else if (this.data.isChoose == 1) {
        wx.navigateTo({
          url: '/pages/travel/index'
        })
      } else if (this.data.isChoose == 2) {
        wx.navigateTo({
          url: '/pages/hotspot/index'
        })
      }
    },
    bindChange(e) {
      if (e.detail.current == 0) {
        this.data.title = '吃莆田'
      } else if (e.detail.current == 1) {
        this.data.title = '游莆田'
      } else if (e.detail.current == 2) {
        this.data.title = '看莆田'
      }
      this.setData({
        title: this.data.title,
        isChoose: e.detail.current
      });
    },
  }
})
